package com.bilibili.api;

import com.bilibili.domain.Result;
import com.bilibili.domain.User;
import com.bilibili.domain.UserInfo;
import com.bilibili.service.UserService;
import com.bilibili.util.RSAUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class UserApi {

    @Resource
    private UserService userService;

    @GetMapping("rsa-pks")
    public Result<String> getRsaPulicKey(){
        String key = RSAUtil.getPublicKeyStr();
        return new Result<>(key);
    }

    @PostMapping("/users")
    public Result<String> addUsers(@RequestBody User user){
        userService.addUser(user);
        return Result.success();
    }

}
